matchesLanguageAndScript

@RequiresApi(value = 21)
open fun matchesLanguageAndScript(@NonNull supported: Locale, @NonNull desired: Locale): Boolean(source)

Determine whether two locales are considered a match, even if they are not exactly equal. They are considered as a match when both of their languages and scripts (explicit or inferred) are identical. This means that a user would be able to understand the content written in the supported locale even if they say they prefer the desired locale. E.g. [zh-HK] matches [zh-Hant]; [en-US] matches [en-CA].

Return

True if they match, false otherwise.

Parameters

supported

The supported Locale to be compared.

desired

The desired Locale to be compared.